package erfgame.core.world.terrain.insertion;

import java.awt.Color;
import java.awt.image.IndexColorModel;
import java.sql.BatchUpdateException;

@Deprecated
public class DefaultSelectionColorModelFactory {
	
	public static final Color createSelectionColor() {
		return Color.yellow;
	}
	
	public static final IndexColorModel createColorModel( int size ) {
		byte[] red = new byte[ size ];
		byte[] green = new byte[ size ];
		byte[] blue = new byte[ size ];
		byte[] alpha = new byte[ size ];
		int sqrt = (int)Math.sqrt( size );
		int index = 0;
		for( int grad = 0; grad < sqrt; grad++ ) {
			int redComp = (128 * grad) / (sqrt-1) + 127;
			int greenComp = redComp/2;
			int blueComp = redComp/2;
			for( int alphaMult = 0; alphaMult < sqrt; alphaMult++ ) {
				int alphaComp = (255 * alphaMult) / sqrt-1;
				red[index] = (byte)redComp;
				green[index] = (byte)greenComp;
				blue[index] = (byte)blueComp;
				alpha[index] = (byte)alphaComp;
				index++;
			}
		}
		
		IndexColorModel result = new IndexColorModel(8, size, red, green, blue, alpha);
		int tt = result.getTransparency();
		return result;
	}
}
